<?php

$output = array(
    "success" => $success,
    "results" => array(),
);

foreach($results as $result) {
    $output["results"][] = $result->getRawValue();
}

echo json_encode($output);
